import * as Yup from "yup"
const schema = Yup.object().shape({
	buy_videos: Yup.array().min(1, "名片视频至少上传1个").required("名片视频不能为空"),
	shop_image: Yup.array().min(1, "名片展示图至少上传1个").required("名片展示图不能为空"),
	username: Yup.string().required("不能为空").min(6, "最少输入6个字符").max(30, "最多输入30个字符"),
	reg_time: Yup.string().required("不能为空"),
	reg_address: Yup.string().required("不能为空").min(6, "最少输入6个字符").max(30, "最多输入30个字符"),
	profile: Yup.string().required("不能为空").min(6, "最少输入6个字符").max(200, "最多输入200个字符"),
	main_product: Yup.string().required("不能为空").min(6, "最少输入6个字符").max(50, "最多输入50个字符"),
	provide_transport_id: Yup.string().required("请选择").test("运输方式验证", "请至少选择一种", value => {
		return value && value.split(",")[0]
	}),
	provide_services_id: Yup.string().required("请选择").test("提供服务方式验证", "请至少选择一种", value => {
		return value && value.split(",")[0]
	}),
	kouan: Yup.array().required("请选择").test("口岸", "请至少添加一个", value => {
		return value.length > 0 && value[0].id
	}),
	area_id: Yup.mixed().test("公司所在地", "请选择", value => {
		return value && value != null && value !== ""
	}),
	industry_direction_start: Yup.string().required("请选择").test("业务方向双验证", "请选择", (value, obj) => {
		return obj.parent.industry_direction_start && obj.parent.industry_direction_end
	}),
	industry_direction_end: Yup.string().required("请选择").test("业务方向双验证", "请选择", (value, obj) => {
		return obj.parent.industry_direction_start && obj.parent.industry_direction_end
	}),
	transport_type: Yup.string().required("请选择").test("业务选项验证", "请至少选择一种", value => {
		return value && value.split(",")[0]
	}),
	// license_images: Yup.array(),
	// company_images: Yup.array(),
	// car_images: Yup.array(),
	// transport_images: Yup.array(),
	// service_images: Yup.array(),
})

export default schema